<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>薪资定级</title>
    <script src="../../../../../res/js/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="../../../../../res/js/login_common.js" charset="utf-8"></script>
    <script src="../../../../../res/layui/layui.js" charset="utf-8"></script>
    <script src="../../../../../res/js/Tools.js" charset="utf-8"></script>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../../res/images/favicon.ico">
    <link rel="stylesheet" href="../../../../../res/layui/css/layui.css" media="all">
    <style>
        #isHealthMaimLevel {
            display: none;
        }
    </style>
</head>
<body style="padding: 10px">
<div style="display: none" id="bodys">
    <form action="" class="layui-form layui-form-pane" lay-filter="example">
        <h1 align="center" style="margin-bottom: 20px">员工薪资调整表</h1>
        <!--流程id-->
        <input name="pkGradeId" id="pkGradeId" type="hidden"/>
        <!--流程进度-->
        <input name="isRevision" id="isRevision" type="hidden"/>
        <!--员工id-->
        <input name="personnelId" id="personnelId" type="hidden"/>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">员工工号</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" name="employeeNumber"
                           id="employeeNumber" placeholder="请输入工号（必填）" disabled=""
                           type="text"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" name="personnelName"
                           id="personnelName" placeholder="请输入名字（必填）" disabled=""
                           type="text"/>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">入职日期</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" id="affirmTime" lay-verify="date"
                           name="affirmTime" disabled=""
                           placeholder="yyyy-MM-dd（必填）"
                           type="text">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">部门</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" id="departmentName"
                           name="departmentName" placeholder="请输入部门（必填）" disabled=""
                           type="text"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">岗位</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="required" id="postName"
                           name="postName" placeholder="请输入岗位（必填）" disabled=""
                           type="text"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">生效日期</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" class="layui-input" lay-verify="date" name="reachTime"
                           id="reachTime" placeholder="生效日期（必填）"
                           type="text"/>
                </div>
            </div>
        </div>
        <div class="layui-form-item" pane="">
            <label class="layui-form-label" style="width: 200px" >薪资定级/调整原因</label>
            <div class="layui-input-block" style="margin-left: 200px" >
                <input type="radio" id="gradeType" name="gradeType" value="0" title="新录用" checked="">
                <input type="radio" id="gradeType1" name="gradeType" value="1" title="晋升">
                <input type="radio" id="gradeType2" name="gradeType" value="2" title="降职" >
                <input type="radio" id="gradeType3" name="gradeType" value="3" title="年度调薪水" >
                <input type="radio" id="gradeType4" name="gradeType" value="4" title="其他" >
            </div>
        </div>
        <div style="width: 45%;float: left">
            <fieldset class="layui-elem-field">
                <legend>调整前</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">基本工资</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeSalary"
                                       id="frontBeforeSalary" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">住房补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeHousing"
                                       id="frontBeforeHousing" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">交通补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeTraffic"
                                       id="frontBeforeTraffic" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">社保补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeSocialSecurity"
                                       id="frontBeforeSocialSecurity" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">工龄补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeSeniority"
                                       id="frontBeforeSeniority" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">其他补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontBeforeElse"
                                       id="frontBeforeElse" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">合计</label>
                            <div class="layui-input-block">
                                <input type="text" name="frontBeforeTotal" id="frontBeforeTotal" lay-verify="required|number" autocomplete="off"
                                       placeholder="合计"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>


        <div style="width: 45%;float: left">
            <fieldset class="layui-elem-field">
                <legend>调整后</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">基本工资</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterSalary"
                                       id="frontLaterSalary" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">住房补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterHousing"
                                       id="frontLaterHousing" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">交通补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterTraffic"
                                       id="frontLaterTraffic" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">社保补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterSocialSecurity"
                                       id="frontLaterSocialSecurity" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">工龄补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterSeniority"
                                       id="frontLaterSeniority" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-inline">
                            <label class="layui-form-label">其他补贴</label>
                            <div class="layui-input-inline">
                                <input autocomplete="off" class="layui-input" lay-verify="required|number"
                                       name="frontLaterElse"
                                       id="frontLaterElse" placeholder="请输入（必填）"
                                       type="text"/>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">合计</label>
                            <div class="layui-input-block">
                                <input type="text" name="frontLaterTotal" id="frontLaterTotal" lay-verify="required|number" autocomplete="off"
                                       placeholder="合计"
                                       class="layui-input">
                            </div>
                        </div>

                    </div>
                </div>
            </fieldset>
        </div>

        <div class="layui-form-item layui-form-text" id="department" style="display: none">
            <label class="layui-form-label">员工所在部门审核意见：</label>
            <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="departmentOpinion" id="departmentOpinion">  </textarea>
            </div>
        </div>

        <div class="layui-form-item layui-form-text" id="staffing" style="display: none">
            <label class="layui-form-label">人事部审核意见：</label>
            <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="personnelOpinion" id="personnelOpinion">  </textarea>
            </div>
        </div>


        <div class="layui-form-item layui-form-text" id="exection" style="display: none">
            <label class="layui-form-label">总经理审核意见：</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea" name="managerOpinion" id="managerOpinion">  </textarea>
            </div>
        </div>
        <!-- 提交-->
        <div class="layui-form-item" id="sub">
            <div class="layui-input-block" id="flowTwo">
                <button type="submit" class="layui-btn site-demo-active" lay-submit="" lay-filter="demo1">通过</button>
                <input type="button" id="demo2" class="layui-btn layui-btn-primary site-demo-active" value="不通过"/>
            </div>
        </div>
    </form>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>流程日志</legend>
    </fieldset>
    <ul class="layui-timeline" id="schedule">

    </ul>
</div>
<script>
    let pkGradeId = getQueryString("pkGradeId");
    let show = getQueryString("show");
    layui.use(['form', 'laydate', 'table'], function () {
        var table = layui.table
            , form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;

        //入职日期
        laydate.render({
            elem: '#reachTime'
        });

        let res;
        if (pkGradeId) {
            $("#pkGradeId").val(pkGradeId);
            //查询员工转正流程
            res = getAjaxById(getRootPath() + "OaGradeFlowAction/findById/" + pkGradeId);
            $("#isRevision").val(res.isRevision);
            // W 为人事填写 D 为部门审核 S 为人事审核 X 为总经理审核
            if(res.isRevision === "W"){
                //调用R的方法
                staffingNode(res);
                $("#demo2").hide();
            }else if(res.isRevision === "D"){
                //这里面调用D的方法 D的方法里面调用了R的方法
                auditSectionNode(res);
            }else if(res.isRevision === "S"){
                // 这里调用S的方法 S的方法里面调用了D的方法
                auditStaffingNode(res);
            }else if(res.isRevision === "X"){
                // 这里调用S的方法 X的方法里面调用了S的方法
                auditStaffingE(res)
            }else if(show){
                //全部审核完毕禁用所有控件 查看页面
                isShow(res);
            }
            //入职日期赋值
            $("#affirmTime").val(dateFormat('yyyy-MM-dd', new Date(res.affirmTime)));

            //通过人员id查询申请人信息
           let ress = getAjaxById(getRootPath() + "OaPersonnelAction/findById/" + res.personnelId);
            console.info(ress);
            console.info(ress.data.personnelName);
            // 员工名称
            $("#personnelName").val(ress.data.personnelName);
            // 员工工号
            $("#employeeNumber").val(ress.data.employeeNumber);
            // 员工id
            $("#personnelId").val(ress.data.pkPersonnelId);
            // 部门
            $("#departmentName").val(ress.data.departmentName);
            // 岗位
            $("#postName").val(ress.data.postName);
            form.render();
        }


        if (res) {
            // 查询入职时间
            let data = getAjaxById(getRootPath()+"oaEntryFlowAction/findByPersonnelId");
            if(data){
                $("#affirmTime").val(dateFormat('yyyy-MM-dd', new Date(data.affirmTime)));
            }
            form.render();
        }


        //监听起草提交
        form.on('submit(demo1)', function (data) {
            console.info(data.field);
            // 单击之后提交按钮不可选,防止重复提交
            const DISABLED = 'layui-btn-disabled';
            let site_demo_active=$('.site-demo-active');
            // 增加样式
            site_demo_active.addClass(DISABLED);
            // 增加属性
            site_demo_active.attr('disabled', 'disabled');
            console.log(data.field.isRevision);
            let url="OaGradeFlowAction/staffingWrite";
            if(data.field.isRevision === "D"){
                url="OaGradeFlowAction/departMentPass";
            }else if(data.field.isRevision === "S"){
                url="OaGradeFlowAction/staffingPass";
            }else if(data.field.isRevision === "X"){
                url="OaGradeFlowAction/exPass";
            }
            const res = postAjax(getRootPath() + url, data.field);
            console.log(res);
            if (res === 1) {
                layer.msg('新增成功3秒后关闭当前窗口', {icon: 1});
                setTimeout(function () {
                    formClose();
                }, 3000);
                setTimeout(function () {
                    parent.layui.table.reload('test');//刷新父页面
                    //window.parent.location.reload();//刷新父页面
                    const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);
                }, 3000);
                //window.location.reload();//刷新页面
            } else if (res.code === 500) {
                error('500');
            } else {
                layer.msg("新增失败");
            }
            return false;
        });
        //监听审核提交不通过
        $('#demo2').on('click', function () {
            //prompt层
            layer.prompt({
                formType: 2,
                value: '',
                title: '请输入原因',
                area: ['300px', '100px']
            }, function (text, index) {
                layer.close(index);
                let datas = {
                    formReason: text,
                    pkGradeId: $("#pkGradeId").val(),
                    personnelId:$("#personnelId").val()
                };
                // 单击之后提交按钮不可选,防止重复提交
                const DISABLED = 'layui-btn-disabled';
                let site_demo_active=$('.site-demo-active');
                // 增加样式
                site_demo_active.addClass(DISABLED);
                // 增加属性
                site_demo_active.attr('disabled', 'disabled');

                let url;
                if($("#isRevision").val() === "D"){
                    url="OaGradeFlowAction/departMentNoPass";
                }else if($("#isRevision").val() === "S"){
                    url="OaGradeFlowAction/staffingNoPass";
                }else if($("#isRevision").val() === "X"){
                    url="OaGradeFlowAction/exNoPass";
                }

                /*layer.msg('您最后写下了：'+text);*/
                const res = postAjax(getRootPath() + url, datas);
                if (res.code === 1) {
                    layer.msg('提交成功3秒后关闭当前窗口', {icon: 1});
                    setTimeout(function () {
                        formClose();
                    },3000);
                    setTimeout(function () {
                        parent.layui.table.reload('test');//刷新父页面
                        //window.parent.location.reload();//刷新父页面
                        const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    },3001);
                } else if (res.code === 500) {
                    error('500');
                } else {
                    layer.msg("新增失败");
                }
            });

            return false;
        });

        if(pkGradeId){
            const ress = getAjaxById(getRootPath() + "OaFlowAction/selectFlowSchedule/" + $("#pkGradeId").val());
            console.log(ress);
            $("#schedule").html("");
            $.each(ress, function (index, item) {
                if (item.createdBy) {
                    $("#schedule").append('<li class="layui-timeline-item">\n' +
                        '        <i class="layui-icon layui-timeline-axis"></i>\n' +
                        '        <div class="layui-timeline-content layui-text">\n' +
                        '            <h3 class="layui-timeline-title">' + dateFormat('yyyy-MM-dd hh:mm:ss', new Date(item.createdTime)) + '&nbsp;&nbsp;&nbsp;' + item.flowName + '</h3>\n' +
                        '            <p>' + item.formReason + '</p>\n' +
                        '            <p>操作人：' + item.createdBy + '</p>\n' +
                        '        </div>\n' +
                        '    </li>')
                } else {
                    $("#schedule").append('<li class="layui-timeline-item">\n' +
                        '        <i class="layui-icon layui-timeline-axis"></ i>\n' +
                        '        <div class="layui-timeline-content layui-text">\n' +
                        '            <h3 class="layui-timeline-title">' + dateFormat('yyyy-MM-dd hh:mm:ss', new Date(item.createdTime)) + '&nbsp;&nbsp;&nbsp;' + item.flowName + '</h3>\n' +
                        '            <p>' + item.formReason + '</p>\n' +
                        '        </div>\n' +
                        '    </li>')
                }
            });
        }

        if (isButton("ENTRY_CHECK") && $("#isRevision").val() === "L") {
            $("#entryCheck").show();
            $("#trialDate").attr("lay-verify", "required");
            $("#trialMoney").attr("lay-verify", "required");
            $("#officialMoney").attr("lay-verify", "required");
        }
        $("#bodys").show();
        form.render();

        /**
         * 前基本工资
         **/
        $("#frontBeforeSalary").on("blur",function () {
            beforeTotal();
        });

        /**
         * 前住房补贴
         **/
        $("#frontBeforeHousing").on("blur",function () {
            beforeTotal();
        });

        /**
         * 前交通补贴
         **/
        $("#frontBeforeTraffic").on("blur",function () {
            beforeTotal();
        });

        /**
         * 前社保补贴
         **/
        $("#frontBeforeSocialSecurity").on("blur",function () {
            beforeTotal();
        });

        /**
         * 前工龄补贴
         **/
        $("#frontBeforeSeniority").on("blur",function () {
            beforeTotal();
        });

        /**
         * 前其他补贴
         **/
        $("#frontBeforeElse").on("blur",function () {
            beforeTotal();
        });

        /**
         * 后基本工资
         **/
        $("#frontLaterSalary").on("blur",function () {
            laterTotal();
        });

        /**
         * 后住房补贴
         **/
        $("#frontLaterHousing").on("blur",function () {
            laterTotal();
        });

        /**
         * 后交通补贴
         **/
        $("#frontLaterTraffic").on("blur",function () {
            laterTotal();
        });

        /**
         * 后社保补贴
         **/
        $("#frontLaterSocialSecurity").on("blur",function () {
            laterTotal();
        });

        /**
         * 后工龄补贴
         **/
        $("#frontLaterSeniority").on("blur",function () {
            laterTotal();
        });

        /**
         * 后其他补贴
         **/
        $("#frontLaterElse").on("blur",function () {
            laterTotal();
        });
    });

    /**
     * 调整前计算总和
     **/
    function beforeTotal() {
        let frontBeforeSalary = Number($("#frontBeforeSalary").val()); // 基本工资
        let frontBeforeHousing= Number($("#frontBeforeHousing").val()); // 住房补贴
        let frontBeforeTraffic= Number($("#frontBeforeTraffic").val()); // 交通补贴
        let frontBeforeSocialSecurity= Number($("#frontBeforeSocialSecurity").val()); // 社保补贴
        let frontBeforeSeniority= Number($("#frontBeforeSeniority").val()); // 工龄补贴
        let frontBeforeElse= Number($("#frontBeforeElse").val()); // 其他补贴
        let frontBeforeTotal=(frontBeforeSalary*100+frontBeforeHousing*100+frontBeforeTraffic*100+frontBeforeSocialSecurity*100+frontBeforeSeniority*100+frontBeforeElse*100)/100;
        $("#frontBeforeTotal").val(frontBeforeTotal .toFixed(2)); // 合计
    }

    /**
     * 调整后计算总和
     **/
    function laterTotal() {
        let frontLaterSalary = Number($("#frontLaterSalary").val()); // 基本工资
        let frontLaterHousing= Number($("#frontLaterHousing").val()); // 住房补贴
        let frontLaterTraffic= Number($("#frontLaterTraffic").val()); // 交通补贴
        let frontLaterSocialSecurity= Number($("#frontLaterSocialSecurity").val()); // 社保补贴
        let frontLaterSeniority= Number($("#frontLaterSeniority").val()); // 工龄补贴
        let frontLaterElse= Number($("#frontLaterElse").val()); // 其他补贴
        let frontLaterTotal=(frontLaterSalary*100+frontLaterHousing*100+frontLaterTraffic*100+frontLaterSocialSecurity*100+frontLaterSeniority*100+frontLaterElse*100)/100;
        $("#frontLaterTotal").val(frontLaterTotal.toFixed(2)); // 合计
    }

    /**
     * 人事填写
     */
    function staffingNode(data) {
        let res=getAjaxById(getRootPath()+"OaPersonnelAction/findById/"+data.personnelId);
        let affirmTime=$("#affirmTime");
        affirmTime.val(data.affirmTime); // 入职时间
        formDisabled(affirmTime);

        let personnelName= $("#personnelName");
        personnelName.val(res.data.personnelName); // 人员名称
        formDisabled(personnelName);

        let employeeNumber= $("#employeeNumber");
        employeeNumber.val(res.data.employeeNumber); // 人员编号
        formDisabled(employeeNumber);

        let departmentName=$("#departmentName");
        departmentName.val(res.data.departmentName); // 部门
        formDisabled(departmentName);

        let postName= $("#postName");
        postName.val(res.data.postName); // 岗位
        formDisabled(postName);

        $("input[name=gradeType][value='0']").attr("checked", data.gradeType == 0 ? true : false);
        $("input[name=gradeType][value='1']").attr("checked", data.gradeType == 1 ? true : false);
        $("input[name=gradeType][value='2']").attr("checked", data.gradeType == 2 ? true : false);
        $("input[name=gradeType][value='3']").attr("checked", data.gradeType == 3 ? true : false);
        $("input[name=gradeType][value='4']").attr("checked", data.gradeType == 4 ? true : false);


        //前
        let frontBeforeSalary=$("#frontBeforeSalary");
        frontBeforeSalary.val(data.frontBeforeSalary); // 基本工资

        let frontBeforeHousing=$("#frontBeforeHousing");
        frontBeforeHousing.val(data.frontBeforeHousing); // 住房补贴

        let frontBeforeTraffic= $("#frontBeforeTraffic");
        frontBeforeTraffic.val(data.frontBeforeTraffic); // 交通补贴

        let frontBeforeSocialSecurity=$("#frontBeforeSocialSecurity");
        frontBeforeSocialSecurity.val(data.frontBeforeSocialSecurity); // 社保补贴

        let frontBeforeSeniority=$("#frontBeforeSeniority");
        frontBeforeSeniority.val(data.frontBeforeSeniority); // 工龄补贴

        let frontBeforeElse=$("#frontBeforeElse");
       frontBeforeElse.val(data.frontBeforeElse); // 其他补贴

        let frontBeforeTotal=$("#frontBeforeTotal");
        frontBeforeTotal.val(data.frontBeforeTotal); //合计
        // 后
        let  frontLaterSalary=$("#frontLaterSalary");
        frontLaterSalary.val(data.frontLaterSalary); // 基本工资

        let frontLaterHousing=$("#frontLaterHousing");
        frontLaterHousing.val(data.frontLaterHousing); // 住房补贴

        let frontLaterTraffic=$("#frontLaterTraffic");
        frontLaterTraffic.val(data.frontLaterTraffic); // 交通补贴

        let frontLaterSocialSecurity= $("#frontLaterSocialSecurity");
        frontLaterSocialSecurity.val(data.frontLaterSocialSecurity); // 社保补贴

        let frontLaterSeniority=$("#frontLaterSeniority");
        frontLaterSeniority.val(data.frontLaterSeniority); // 工龄补贴

        let frontLaterElse=$("#frontLaterElse");
        frontLaterElse.val(data.frontLaterElse); // 其他补贴

        let frontLaterTotal=$("#frontLaterTotal");
        frontLaterTotal.val(data.frontLaterTotal); //合计

        let reachTime=$("#reachTime");
        reachTime.val(dateFormat('yyyy-MM-dd', new Date(data.reachTime)));
    }

    /**
     * 禁用
     *  @param forms 控件
     */
    function formDisabled(forms) {
        const DISABLED = 'layui-btn-disabled';
        forms.attr('disabled', 'disabled');
        forms.addClass(DISABLED);
    }
    /**
     * 部门审核
     */
    function auditSectionNode(data) {
        staffingNode(data);
        let frontBeforeSalary=$("#frontBeforeSalary");// 基本工资
        formDisabled(frontBeforeSalary);
        let frontBeforeHousing=$("#frontBeforeHousing");// 住房补贴
        formDisabled(frontBeforeHousing);
        let frontBeforeTraffic= $("#frontBeforeTraffic");// 交通补贴
        formDisabled(frontBeforeTraffic);
        let frontBeforeSocialSecurity=$("#frontBeforeSocialSecurity");// 社保补贴
        formDisabled(frontBeforeSocialSecurity);
        let frontBeforeSeniority=$("#frontBeforeSeniority");// 工龄补贴
        formDisabled(frontBeforeSeniority);
        let frontBeforeElse=$("#frontBeforeElse");// 其他补贴
        formDisabled(frontBeforeElse);
        let frontBeforeTotal=$("#frontBeforeTotal");//合计
        formDisabled(frontBeforeTotal);

        let  frontLaterSalary=$("#frontLaterSalary");// 基本工资
        formDisabled(frontLaterSalary);
        let frontLaterHousing=$("#frontLaterHousing");// 住房补贴
        formDisabled(frontLaterHousing);
        let frontLaterTraffic=$("#frontLaterTraffic");// 交通补贴
        formDisabled(frontLaterTraffic);
        let frontLaterSocialSecurity= $("#frontLaterSocialSecurity");// 社保补贴
        formDisabled(frontLaterSocialSecurity);
        let frontLaterSeniority=$("#frontLaterSeniority");//工龄补贴
        formDisabled(frontLaterSeniority);
        let frontLaterElse=$("#frontLaterElse");// 其他补贴
        formDisabled(frontLaterElse);
        let frontLaterTotal=$("#frontLaterTotal");//合计
        formDisabled(frontLaterTotal);

        let gradeType= $("#gradeType");
        formDisabled(gradeType);
        let gradeType1= $("#gradeType1");
        formDisabled(gradeType1);
        let gradeType2= $("#gradeType2");
        formDisabled(gradeType2);
        let gradeType3= $("#gradeType3");
        formDisabled(gradeType3);
        let gradeType4= $("#gradeType4");
        formDisabled(gradeType4);

        let reachTime=$("#reachTime");// 生效日期
        formDisabled(reachTime);
        let department=$("#department");
        $("#department textarea").attr("lay-verify","required");
        department.show();
    }

    /**
     * 人事审核
     */
    function auditStaffingNode(data) {
        auditSectionNode(data);
        let  departmentOpinion=$("#departmentOpinion");
        departmentOpinion.val(data.departmentOpinion); // 部门意见
        formDisabled(departmentOpinion);
        let staffing=$("#staffing");
        $("#staffing textarea").attr("lay-verify","required");
        staffing.show();
    }
    /**
     * 总经理审核
     */
    function auditStaffingE(data) {
        auditStaffingNode(data);
        let  personnelOpinion=$("#personnelOpinion");
       personnelOpinion.val(data.personnelOpinion); // 人事意见
        formDisabled(personnelOpinion);
        let exection=$("#exection");
        $("#exection textarea").attr("lay-verify","required");
        exection.show();
    }
    /**
     * 查看页面
     * @param data 流程模型
     */
    function isShow(data) {
        auditStaffingE(data);
        // 部门意见
        let managerOpinion=$("#managerOpinion");
        managerOpinion.val(data.managerOpinion);
        formDisabled(managerOpinion);
        $("#sub").remove();
    }
</script>
</body>
</html>